<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>studnet</title>
    <link rel="stylesheet" href="/styles/student.css">
    <script src="/js/delete.js"></script>

</head>
<body>
    <header>
        <div>
            <div>
                <i>🎓</i>
                <h1>教育查询系统</h1>
            </div>
        </div>
    </header>
    <form action="/toadd" method="GET">
    <button type="submit" class="add-button">添加新的学生</button>
    </form>
    <table>
        <tr>
            <th>StudentID</th>
            <th>Name</th>
            <th>Gender</th>
            <th>EnrollmentYear</th>
            <th>Major</th>
            <th>Class</th>
            <th>ParentPhone</th>
            <th>FinalAvgScore</th>
            <th>Status</th>
        </tr>
        {{range .Students}}
        <tr>
            <td>{{.StudentID}}</td>
            <td>{{.Name}}</td>
            <td>{{.Gender}}</td>
            <td>{{.EnrollmentYear}}</td>
            <td>{{.MajorName}}</td>
            <td>{{.ClassName}}</td>
            <td>{{.ParentPhone}}</td>
            <td>{{.FinalAvgScore}}</td>
            <td>{{.Status}}</td>
         <td>
    <button class="delete-button" data-id="{{.StudentID}}" data-type="student">删除</button>
        </td>
        </tr>
        {{end}}
    </table>

    <div>
        {{if gt .Page 1}}
        <a href="/student?page={{sub .Page 1}}">上一页</a>
        {{end}}
        <a href="/student?page={{add .Page 1}}">下一页</a>
    </div>
    <form action="/index" method="GET">
        <button type="submit" class="add-button">返回主页</button>
    </form>
</body>
</html>